app.service('shopBusinessEditService',['$q','utilService',function($q,utilService){
    var _this_=this;

    //查询店铺信息
    _this_.findByShopId= function ($scope) {
        var deferred = $q.defer();
        utilService.get({
            url:$scope.app.domain + 'shop/info'
        }).then(function(response){
            deferred.resolve(response.data);
        },function(e){
            console.error(e);
            deferred.reject("连接服务器出错！");
        })

        return deferred.promise;
    }


    _this_.update=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain+"/shop/info",
            data:$scope.shopInfo,
            method:'PUT'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }


    _this_.delImage=function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain+"/shop/info",
            data:{imgType:$scope.imgType,id:$scope.shopInfo.id},
            method:'DELETE'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }

}])